#include "intersection.h"

Intersection::Intersection()
    : Point3D(), dist(1e100), valid(false), object(0)
{

}

Intersection::~Intersection() {}

Intersection::Intersection(const Intersection &inter)
    : Point3D(inter), dist(inter.dist), valid(inter.valid), object(inter.object)
{

}

Intersection& Intersection::operator=(const Intersection &inter)
{
    x = inter.x;
    y = inter.y;
    z = inter.z;
    dist   = inter.dist;
    valid  = inter.valid;
    object = inter.object;
    return (*this);
}

Intersection::Intersection(const Point3D &p,double _dist,SolidObject * _object)
    : Point3D(p), dist(_dist), valid(true), object(_object)
{

}

inline double Intersection::getDistance() const
{
    return dist;
}

inline void Intersection::setDistance(const double &d)
{
    dist = d;
}


inline void Intersection::setValid(bool v)
{
    valid = v;
}

inline bool Intersection::isValid() const
{
    return valid;
}

inline bool Intersection::operator<(const Intersection &i) const
{
    return (dist < i.dist);
}

inline bool Intersection::operator>(const Intersection &i) const
{
    return (dist > i.dist);
}


inline SolidObject * Intersection::getObject() const
{
    return object;
}

inline void Intersection::setObject(SolidObject *_object)
{
    object = _object;
}
